home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacOS 8 Resources / Developer Tools / Mac OS 8 Interfaces & Libraries / Interfaces / CIncludes / Palettes.h < prev    next >
C/C++ Source or Header  |  1996-05-01  |  6KB  |  192 lines

  1. /*
  2.      File:        Palettes.h
  3.  
  4.      Contains:    Palette Manager Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Release:    Universal Interfaces 3.0d3 on Copland DR1
  8.  
  9.      Copyright:    © 1984-1996 by Apple Computer, Inc.  All rights reserved.
  10.  
  11.      Bugs?:        If you find a problem with this file, send the file and version
  12.                  information (from above) and the problem description to:
  13.  
  14.                      Internet:    apple.bugs@applelink.apple.com
  15.                      AppleLink:    APPLE.BUGS
  16.  
  17. */
  18. #ifndef __PALETTES__
  19. #define __PALETTES__
  20.  
  21. #ifndef __QUICKDRAW__
  22. #include <Quickdraw.h>
  23. #endif
  24. #ifndef __WINDOWS__
  25. #include <Windows.h>
  26. #endif
  27.  
  28. #ifdef __cplusplus
  29. extern "C" {
  30. #endif
  31.  
  32. #if PRAGMA_IMPORT_SUPPORTED
  33. #pragma import on
  34. #endif
  35.  
  36. #if PRAGMA_ALIGN_SUPPORTED
  37. #pragma options align=mac68k
  38. #endif
  39.  
  40. #if FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE
  41.  
  42. enum {
  43.     pmCourteous                    = 0,                            /*Record use of color on each device touched.*/
  44.     pmTolerant                    = 0x0002,                        /*render ciRGB if ciTolerance is exceeded by best match.*/
  45.     pmAnimated                    = 0x0004,                        /*reserve an index on each device touched and render ciRGB.*/
  46.     pmExplicit                    = 0x0008,                        /*no reserve, no render, no record; stuff index into port.*/
  47.     pmWhite                        = 0x0010,
  48.     pmBlack                        = 0x0020,
  49.     pmInhibitG2                    = 0x0100,
  50.     pmInhibitC2                    = 0x0200,
  51.     pmInhibitG4                    = 0x0400,
  52.     pmInhibitC4                    = 0x0800,
  53.     pmInhibitG8                    = 0x1000,
  54.     pmInhibitC8                    = 0x2000,                        /* NSetPalette Update Constants */
  55.     pmNoUpdates                    = 0x8000,                        /*no updates*/
  56.     pmBkUpdates                    = 0xA000,                        /*background updates only*/
  57.     pmFgUpdates                    = 0xC000,                        /*foreground updates only*/
  58.     pmAllUpdates                = 0xE000                        /*all updates*/
  59. };
  60.  
  61. struct ColorInfo {
  62.     RGBColor                         ciRGB;                        /*true RGB values*/
  63.     short                             ciUsage;                    /*color usage*/
  64.     short                             ciTolerance;                /*tolerance value*/
  65.     short                             ciDataFields[3];            /*private fields*/
  66. };
  67. typedef struct ColorInfo ColorInfo;
  68.  
  69. typedef ColorInfo *ColorInfoPtr;
  70. typedef ColorInfoPtr *ColorInfoHandle;
  71. struct Palette {
  72.     short                             pmEntries;                    /*entries in pmTable*/
  73.     short                             pmDataFields[7];            /*private fields*/
  74.     ColorInfo                         pmInfo[1];
  75. };
  76. typedef struct Palette Palette;
  77.  
  78. typedef Palette *PalettePtr;
  79. typedef PalettePtr *PaletteHandle;
  80. extern pascal void InitPalettes(void )
  81.  ONEWORDINLINE(0xAA90);
  82.  
  83. extern pascal PaletteHandle NewPalette(short entries, CTabHandle srcColors, short srcUsage, short srcTolerance)
  84.  ONEWORDINLINE(0xAA91);
  85.  
  86. extern pascal PaletteHandle GetNewPalette(short PaletteID)
  87.  ONEWORDINLINE(0xAA92);
  88.  
  89. extern pascal void DisposePalette(PaletteHandle srcPalette)
  90.  ONEWORDINLINE(0xAA93);
  91.  
  92. extern pascal void ActivatePalette(WindowPtr srcWindow)
  93.  ONEWORDINLINE(0xAA94);
  94.  
  95. extern pascal void SetPalette(WindowPtr dstWindow, PaletteHandle srcPalette, Boolean cUpdates)
  96.  ONEWORDINLINE(0xAA95);
  97.  
  98. extern pascal void NSetPalette(WindowPtr dstWindow, PaletteHandle srcPalette, short nCUpdates)
  99.  ONEWORDINLINE(0xAA95);
  100.  
  101. extern pascal PaletteHandle GetPalette(WindowPtr srcWindow)
  102.  ONEWORDINLINE(0xAA96);
  103.  
  104. extern pascal void CopyPalette(PaletteHandle srcPalette, PaletteHandle dstPalette, short srcEntry, short dstEntry, short dstLength)
  105.  ONEWORDINLINE(0xAAA1);
  106.  
  107. extern pascal void PmForeColor(short dstEntry)
  108.  ONEWORDINLINE(0xAA97);
  109.  
  110. extern pascal void PmBackColor(short dstEntry)
  111.  ONEWORDINLINE(0xAA98);
  112.  
  113. extern pascal void AnimateEntry(WindowPtr dstWindow, short dstEntry, const RGBColor *srcRGB)
  114.  ONEWORDINLINE(0xAA99);
  115.  
  116. extern pascal void AnimatePalette(WindowPtr dstWindow, CTabHandle srcCTab, short srcIndex, short dstEntry, short dstLength)
  117.  ONEWORDINLINE(0xAA9A);
  118.  
  119. extern pascal void GetEntryColor(PaletteHandle srcPalette, short srcEntry, RGBColor *dstRGB)
  120.  ONEWORDINLINE(0xAA9B);
  121.  
  122. extern pascal void SetEntryColor(PaletteHandle dstPalette, short dstEntry, const RGBColor *srcRGB)
  123.  ONEWORDINLINE(0xAA9C);
  124.  
  125. extern pascal void GetEntryUsage(PaletteHandle srcPalette, short srcEntry, short *dstUsage, short *dstTolerance)
  126.  ONEWORDINLINE(0xAA9D);
  127.  
  128. extern pascal void SetEntryUsage(PaletteHandle dstPalette, short dstEntry, short srcUsage, short srcTolerance)
  129.  ONEWORDINLINE(0xAA9E);
  130.  
  131. extern pascal void CTab2Palette(CTabHandle srcCTab, PaletteHandle dstPalette, short srcUsage, short srcTolerance)
  132.  ONEWORDINLINE(0xAA9F);
  133.  
  134. extern pascal void Palette2CTab(PaletteHandle srcPalette, CTabHandle dstCTab)
  135.  ONEWORDINLINE(0xAAA0);
  136.  
  137. extern pascal long Entry2Index(short entry)
  138.  TWOWORDINLINE(0x7000, 0xAAA2);
  139.  
  140. extern pascal void RestoreDeviceClut(GDHandle gd)
  141.  TWOWORDINLINE(0x7002, 0xAAA2);
  142.  
  143. extern pascal void ResizePalette(PaletteHandle p, short size)
  144.  TWOWORDINLINE(0x7003, 0xAAA2);
  145.  
  146. extern pascal void SaveFore(ColorSpec *c)
  147.  THREEWORDINLINE(0x303C, 0x040D, 0xAAA2);
  148.  
  149. extern pascal void SaveBack(ColorSpec *c)
  150.  THREEWORDINLINE(0x303C, 0x040E, 0xAAA2);
  151.  
  152. extern pascal void RestoreFore(const ColorSpec *c)
  153.  THREEWORDINLINE(0x303C, 0x040F, 0xAAA2);
  154.  
  155. extern pascal void RestoreBack(const ColorSpec *c)
  156.  THREEWORDINLINE(0x303C, 0x0410, 0xAAA2);
  157.  
  158. extern pascal OSErr SetDepth(GDHandle gd, short depth, short whichFlags, short flags)
  159.  THREEWORDINLINE(0x303C, 0x0A13, 0xAAA2);
  160.  
  161. extern pascal short HasDepth(GDHandle gd, short depth, short whichFlags, short flags)
  162.  THREEWORDINLINE(0x303C, 0x0A14, 0xAAA2);
  163.  
  164. extern pascal short PMgrVersion(void )
  165.  TWOWORDINLINE(0x7015, 0xAAA2);
  166.  
  167. extern pascal void SetPaletteUpdates(PaletteHandle p, short updates)
  168.  THREEWORDINLINE(0x303C, 0x0616, 0xAAA2);
  169.  
  170. extern pascal short GetPaletteUpdates(PaletteHandle p)
  171.  THREEWORDINLINE(0x303C, 0x0417, 0xAAA2);
  172.  
  173. extern pascal Boolean GetGray(GDHandle device, const RGBColor *backGround, RGBColor *foreGround)
  174.  THREEWORDINLINE(0x303C, 0x0C19, 0xAAA2);
  175.  
  176. #endif
  177.  
  178. #if PRAGMA_ALIGN_SUPPORTED
  179. #pragma options align=reset
  180. #endif
  181.  
  182. #if PRAGMA_IMPORT_SUPPORTED
  183. #pragma import off
  184. #endif
  185.  
  186. #ifdef __cplusplus
  187. }
  188. #endif
  189.  
  190. #endif /* __PALETTES__ */
  191.  
  192.